<?php 
// require('http://127.0.0.1/GLOBAL_PLUGINS/FirePHPCore-0.3.2/lib/FirePHPCore/fb.php'); esto no funciona
// require_once('../includes_php/FirePHPCore-0.3.2/lib/FirePHPCore/fb.php');
require_once('../includes_php/FirePHPCore-0.3.2/lib/FirePHPCore/fb.php');


@session_start();
include "../include/config.php";
include "../include/db.php";

// $_SESSION['id_rep_dep_o'] = 1070;
// $_SESSION['sector'] = "malone";
// $_SESSION['desc_perfil'] = "super admin";

if(isset($_REQUEST['id_rep_dep'])){

	$_SESSION['id_rep_dep_o'] = $_REQUEST['id_rep_dep'];
	$_SESSION['sector'] = $_REQUEST['sector'];
	// $_SESSION['desc_perfil'] = $_REQUEST['desc_perfil'];
		
	$query3 = "	SELECT id_usuario, id_rep_dep, P.id_perfil, P.desc_perfil
				FROM admin_usuarios_permiso_perfil A
				JOIN admin_perfil P ON (P.id_perfil = A.id_perfil)
				WHERE id_usuario = {$_SESSION['id_usuario']} AND id_rep_dep = {$_REQUEST['id_rep_dep']}"; 

	$result3 = mysql_query($query3) or trigger_error(mysql_error());


	if(mysql_num_rows($result3) != 0 ){
		$row3 = mysql_fetch_array($result3);
		
	}
	
	// if($_SESSION['id_rep_dep_default'] == $_REQUEST['id_rep_dep']){
	else{
		$query3 = "	SELECT id_usuario, id_rep_dep, P.id_perfil, P.desc_perfil
				FROM admin_usuarios_permiso_perfil A
				JOIN admin_perfil P ON (P.id_perfil = A.id_perfil)
				WHERE id_usuario = {$_SESSION['id_usuario']} AND id_rep_dep = 0"; 

		$result3 = mysql_query($query3) or trigger_error(mysql_error());

		$row3 = mysql_fetch_array($result3);	
	}
	
	$_SESSION['desc_perfil'] = $row3['desc_perfil'];	
		
	fb($query3, 'query3');
	fb($row3, 'row3');
	fb(mysql_num_rows($result3), 'num');

	
}



?>